package org.JWCB.judge.domain.vo;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.JWCB.common.core.enums.CodeRunStatus;

import java.util.List;

@Getter
@Setter
@ToString
public class SandBoxExecuteRes {
    private CodeRunStatus runStatus;

    private String exeMessage;

    private List<String> outputList;

    private double useMemory;

    private double useTime;

    public static SandBoxExecuteRes fail(CodeRunStatus runStatus, String errorMsg) {
        SandBoxExecuteRes result = new SandBoxExecuteRes();
        result.setRunStatus(runStatus);
        result.setExeMessage(errorMsg);
        return result;
    }

    public static SandBoxExecuteRes fail(CodeRunStatus runStatus) {
        SandBoxExecuteRes result = new SandBoxExecuteRes();
        result.setRunStatus(runStatus);
        result.setExeMessage(runStatus.getMsg());
        return result;
    }

    public static SandBoxExecuteRes fail(CodeRunStatus runStatus, List<String> outputList,
                                         long useMemory, long useTime) {
        SandBoxExecuteRes result = fail(runStatus);
        result.setOutputList(outputList);
        result.setUseMemory(useMemory);
        result.setUseTime(useTime);
        return result;
    }

    public static SandBoxExecuteRes success(CodeRunStatus runStatus, List<String> outputList,
                                            long useMemory, long useTime) {
        SandBoxExecuteRes result = new SandBoxExecuteRes();
        result.setRunStatus(runStatus);
        result.setOutputList(outputList);
        result.setUseMemory(useMemory);
        result.setUseTime(useTime);
        return result;
    }


}
